package j06chongxie;

class Cat{
    String name;

    public Cat(String name) {
        this.name = name;
    }

    public String toString() {
        return "Cat{" +
                "name='" + name + '\'' +
                '}';
    }
}

public class J2tostring {
    public static void main(String[] args) {
        Cat c1 = new Cat("加菲猫");
        System.out.println(c1);
        System.out.println(c1.toString());
    }
}
